<% results.each do |tag| %>
  <h5>
    <span class="fas fa-tag" style="color: <%= tag.color %>"></span>
    <%= render partial: "search/results/partials/tag_text", locals: { tag: tag, query: search_query } %>
  </h5>

  <p>
    <span>
      <%=t "search.index.created_at" %>
      <%=l tag.created_at, format: :full %>
    </span>
    <br>
    <span>
      <%=t "search.index.modules" %>
      <% if tag.my_modules.count > 0 %>
        <% tag.my_modules.each_with_index do |mod, i| %>
          <%= render partial: "search/results/partials/my_module_text",
                      locals: { my_module: mod, link_to_page: :protocols } %>
          <% if i != tag.my_modules.count - 1 %>
            ,&nbsp;
          <% end %>
        <% end %>
      <% else %>
        <em><%=t "search.index.tag_no_modules" %></em>
      <% end %>
    </span>
    <br>
    <span>
      <%=t "search.index.experiment" %>
      <% if tag.my_modules.count > 0 %>
        <% experiments_results(tag).each_with_index do |exp, i| %>
          <%= render partial: 'search/results/partials/experiment_text',
                     locals: { experiment: exp } %>
          <% if i != (experiments_results(tag).count - 1) %>
            ,&nbsp;
          <% end %>
        <% end %>
      <% end %>
    </span>
    <br>
    <span>
      <%=t "search.index.project" %>
      <%= render partial: "search/results/partials/project_text",
                 locals: { project: tag.project, link_to_page: :show } %>
    </span>
    <br>
    <span>
      <%=t "search.index.team" %>
      <%= render partial: "search/results/partials/team_text",
                 locals: { team: tag.project.team } %>
    </span>
  </p>

  <hr>
<% end %>
